package anonymouschat.messages;

import java.io.Serializable;

import anonymouschat.utils.Print;

/**
 * This is the case class for all messages.
 * 
 * @author bh349
 */
public abstract class Message implements Serializable {

	private static final long serialVersionUID = -1954148520479694286L;

	protected Message() {
		Print.debug("Creating a new message: " + this.toString());
	};

	/**
	 * @return a string of all printable message contents
	 */
	public abstract String getAllContents();

	/**
	 * Converts a null object to an empty string object
	 * 
	 * @param obj
	 *            an object to be checked
	 * @return
	 */
	protected Object fixNull(Object obj) {
		if (obj == null) {
			return "";
		} else
			return obj;
	}
}
